# Maintainer: Filipe Laíns <lains@archlinux.org>
# Maintainer: Frederik Schwan <freswa at archlinux dot org>

pkgname=fwupd-efi
pkgver=1.4
pkgrel=1
pkgdesc='EFI Application used by uefi-capsule plugin in fwupd'
arch=('loong64' 'x86_64')
url='https://github.com/fwupd/fwupd-efi'
license=('LGPL')
makedepends=('meson' 'gnu-efi' 'python-pefile')
source=("https://people.freedesktop.org/~hughsient/releases/${pkgname}-${pkgver}.tar.xz"{,.asc}
        0001-add-support-for-loongarch64.patch)
sha256sums=('27ddbc0a4e3209543eab49e69f1a014eb9ed95f93ff51f966f31082d3b7bffbc'
            'SKIP'
            'be38120643c6afc770733d70fb3191abb63b3f71986140ec219fae174395492d')
validpgpkeys=('163EB50119225DB3DF8F49EA17ACBA8DFA970E17') # Richard Hughes <richard@hughsie.com>

prepare() {
	cd "$pkgname-$pkgver"
	patch -p1 -i "$srcdir/0001-add-support-for-loongarch64.patch"
}

build() {
  arch-meson ${pkgname}-${pkgver} build  \
    -D efi_sbat_distro_id='arch' \
    -D efi_sbat_distro_summary='Arch Linux' \
    -D efi_sbat_distro_pkgname=${pkgname} \
    -D efi_sbat_distro_version=${pkgver} \
    -D efi_sbat_distro_url="https://archlinux.org/packages/community/loongarch64/${pkgname}/"
  ninja -C build
}

package() {
  DESTDIR="${pkgdir}" meson install -C build
}
